using System;
using System.Collections.Generic;
using System.Text;
using System.Drawing;
using System.ComponentModel;
using System.ComponentModel.Design;

namespace TongJi_EMS
{
    public class MyRootForm : System.Windows.Forms.Form
    {
        protected override void OnLoad(EventArgs e)
        {
            this.BackColor = BColor;
            this.Location = new System.Drawing.Point(-5, -5);
            this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.None;
            this.Size = new System.Drawing.Size(1280, 1024);
            base.OnLoad(e);
        }

        protected override void OnPaint(System.Windows.Forms.PaintEventArgs e)
        {
            this.BackColor = BColor;
            base.OnPaint(e);
        }

        private Color _bColor = Color.Black;
        [CategoryAttribute("Data"),
        Description("Indicating the background color")]
        public Color BColor
        {
            get { return _bColor; }
            set
            {
                if (value != _bColor)
                {
                    _bColor = value;
                    this.Refresh();
                }
            }
        }
    }

    //internal class RootFormDesigner : System.Windows.Forms.Design.ControlDesigner
    //{
    //    public MyRootForm RootComponent
    //    {
    //        get { return base.Control as MyRootForm; }
    //    }

    //    public Color BColor
    //    {
    //        set
    //        {
    //            RootComponent.BColor = value;
    //            IComponentChangeService ccs = (IComponentChangeService)GetService(typeof(IComponentChangeService));
    //            if (ccs != null)
    //            {
    //                PropertyDescriptor bColorProp = TypeDescriptor.GetProperties(typeof(MyRootForm))["BColor"];
    //                ccs.OnComponentChanging(RootComponent, bColorProp);
    //                ccs.OnComponentChanged(RootComponent, bColorProp, null, null);
    //            }

    //        }
    //    }
    //}
}
